type Name = {
    name : string,
    age : number
}

export const axios = (url : string) : Promise<Name[]> => {
    return new Promise((resolve)=>{
        let xhr:XMLHttpRequest  = new XMLHttpRequest()
        xhr.open('GET',url)
        xhr.onreadystatechange = (res) => {
            if( xhr.status === 200 && xhr.readyState === 4 ){
                setTimeout(() => {
                    resolve(JSON.parse(xhr.responseText))
                }, 2000);
            }
        }
        xhr.send(null)
    })
}